<!-- 角色管理 -->
<template>
  <div class="system-role-wp clearfix" :class="{more : roleId ? true : false}">
    <template v-if="show">
      <div class="box">
        <role-list @setRoleId="setRoleId"></role-list>
      </div>
      <div class="box user-box" v-if="roleId">
        <div class="delete-btn" @click="setRoleId()">
          <i class="el-icon-circle-close"></i>
        </div>
        <role-user-list :role-id="roleId" @setRoleId="setRoleId"></role-user-list>
      </div>
    </template>
  </div>
</template>
<script>

import roleList from "./modules/role-list.vue";
import roleUserList from "./modules/role-user-list.vue";

export default {
  name: 'system-role',
  components: {
    roleList,
    roleUserList,
  },
  data () {
    return {
      // 选中的角色id
      roleId: '',
      // 控制显示
      show: true,
    }
  },
  mounted () {
    
  },
  methods: {
    // 设置选中的角色id
    setRoleId (id) {
      this.roleId = id;
    }
  }
}
</script>
<style lang="scss" scoped>
.system-role-wp {
  .box  {
    float: left;
    width: 100%;
    padding-left: 5px;
    padding-right: 5px;
    box-sizing: border-box;
    &:first-child {
      padding-left: 0;
    }
    &:last-child {
      padding-right: 0;
    }
  }
  &.more .box {
    width: 50%;
  }
  .user-box {
    position: relative;
    .delete-btn {
      position: absolute;
      z-index: 10;
      top: 10px;
      right: 10px;
      width: 26px;
      height: 26px;
      text-align: center;
      line-height: 26px;
      font-size: 24px;
      cursor: pointer;
    }
  }
}
</style>